<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>左右两栏布局</title>
    <style>
        *{
            margin: 0;
            padding: 0;
            /* box-sizing: border-box; */
        }

        /* 使用float 实现 */
        /* .container{
            height: 100vh;
            border: #5c6beb 2px solid;
            background-color: #5c6beb;
        }
        .left{
            float: left;
            height: 100%;
            width: 200px;
            background-color: rgb(201, 160, 160);
            border: #e9490a 2px solid;
        } */
        /* 生成BFC，防止与左浮动的盒子重叠 */
        /* .right{
            height: 100%;
            overflow: hidden; 
            background-color: rgb(141, 187, 141);
            border: #39c90d 2px solid;
        } */

        .container{
            display: flex;
            height: 100vh;
            background-color: #ccc;
            border: #220ddb 2px solid;
            box-sizing: border-box;
        }
        /* 侧边栏固定宽度为200px */
        .left{
            background-color: rgb(201, 160, 160);
            width: 200px;
            border: #ff0000 2px solid;
        }
        /* 右侧flex:1，自动分配剩余宽度 */
        .right{
            flex: 1;
            background-color: rgb(141, 187, 141);
            border: #39c90d 2px solid;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="left">left</div>
        <div class="right">right</div>
    </div>
    
</body>
</html>